﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;



namespace SocketTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private static byte[] result = new byte[65535];

        private void Test1()
        {
            IPAddress ip = IPAddress.Parse("139.196.160.159");
            Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            clientSocket.Connect(new IPEndPoint(ip, 2001));

            int receiveLength = clientSocket.Receive(result);
            Debug.WriteLine("接收服务器消息：{0}", Encoding.ASCII.GetString(result, 0, receiveLength));

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Test1();
        }

        private void button2_Click(object sender, EventArgs e)
        {

            var aa = 2000 >> 2;
        }

    }
}
